package com.lyx.common.exception;

/**
 * @author 14667
 * @date 2022/7/19 9:21
 */

/**
 * 异常枚举类
 */
public enum ExceptionEnum {

    // 500
    INTERNAL_SERVER_ERROR("500", "服务器内部错误!"),
    SERVICE_UNAVAILABLE("503", "服务器正忙，请稍后再试!"),
    // 未知异常
    UNKNOWN("10000", "未知异常!"),
    // 自定义
    IS_NOT_NULL("10001","%s不能为空"),
    //验证码错误
    CODE_ERROR("10002","验证码输入错误"),
    CODE_INVALID("10003","验证码过期"),
    MISSING_PHONE_OR_CODE("10004","手机号或者验证码为空"),
    ENCODE_UNSUPPORT("10005","编码格式不支持"),
    WX_LOGIN_FAIL("10006","微信登录失败"),
    PHONE_LOGIN_FAIL("10007","手机号登录失败"),
    PHONE_BIND_FAIL("10008","手机号绑定失败"),
    ILLEGAL_LOGIN("10009","非法登录"),
    PHONE_REGIST("10010","该手机号已被绑定"),
    QUESTION_INFO_LACK("10011","题目信息缺失"),
    DATA_CHECK_FAIL("10012","数据校验错误"),
    NOT_EXIST("10013","%s不存在"),
    TOO_FAST("10014","发送太频繁，稍后再试"),
    QUESTION_EXIST("10015","题号已存在"),
    QUESTION_NOT_EXIST("10016","题号不存在"),
    CHAPTER_EXIST("10017","章节名重复或章节已存在"),
    CHAPTER_NOT_EXIST("10018","章节不存在"),
    NO_QUESTION_IN_CHAPTER("10019","该章节下不存在题目"),
    CHAPTER_TYPE_ERROR("10020","章节类型不正确"),
    ES_SAVE_ERROR("10021","ES保存错误"),
    ES_DELETE_ERROR("10022","es删除错误"),
    ES_SEARCH_ERROR("10023","es查询失败"),
    QUESTION_RECORD_SAVE_ERROR("10024","做题记录保存失败"),
    NO_USER_ANSWER("10025","用户没有作答"),
    COMMIT_PAPER_ERROR("10026","交卷失败"),
    PAPER_NOT_FINISH("10027","试卷还未完成"),
    GREATE_PAPER_ERROR("10028","创建试卷失败"),
    USER_NOT_LOGIN("10029","用户未登录"),
    PAPER_FINISH("10030","试卷已完成"),
    USERS_INFO_ERROR("10031","获取用户列表失败"),
    TOKEN_ANALYSIS_ERROR("10032","token解析错误");


    /**
     * 错误码
     */
    private String code;

    /**
     * 错误描述
     */
    private String msg;

    ExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
